//
//  map.hpp
//  RPG
//
//  Created by Matt Bailey on 03/01/2014.
//  Copyright (c) 2014 Matt Bailey. All rights reserved.
//

#pragma once

#include "tile.hpp"
#include "core.hpp"
#include "graphics.hpp"
#include "window.hpp"
#include "dimension.hpp"

#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>

using namespace std;

class Map {
    
    static string rootDirectory;
    static string settings;
    
    static void createTileIndex();
    static vector<glm::vec2> generateVertexData();
    
    static GLuint vertexBuffer;
    static GLuint UVBuffer;
    static GLuint tileSet;
    
    static void generateUVCoords();
    static vector<glm::vec2> UVData;
    
    static unsigned int width, height;
    static int tileWidth;
    
    static int virtualWidth, virtualHeight;
    
    static int bufferSize;
    static int threshold;
    
    static vector<int> mapData_Render;
    static vector<int> mapData;
    
public:

    static void init();
    static void update();
    
    static unsigned int getWidth() { return width; }
    static unsigned int getHeight() { return height; }
    
    static glm::vec2 mapOffset;
    
    static GLuint getVertexBuffer() { return vertexBuffer; }
    static GLuint getUVBuffer() { return UVBuffer; }
    static int getTileWidth() { return tileWidth; }
    static int getBufferSize() { return bufferSize; }
    
    //static GLuint getUVBuffer() { return UVBuffer; }
    
    //static vector<glm::vec2> getVertexData() { return vertexData; }
    //static vector<glm::vec2> getUVData() { return UVData; }
    
    static GLuint getTileSet() { return tileSet; }
    static string& setSettings() { return settings; }
    
    static vector<Tile> tileIndex;
    static Dimension world;
    
    //static vector<UVData> UVIndex;
    
};